package com.java.leetcode;

/**
 * @Author ynb
 * 28. 实现 strStr()
 * @Date 2021/5/28 17:18
 * @Version 1.0
 */
public class  LeetCode028{
    public int strStr(String haystack, String needle) {
        if (needle.length()==0||"null".equals(needle)){
            return 0;
        }

        int i = haystack.indexOf(needle);
        return  i;
    }

    public static void main(String[] args) {
        LeetCode028 l028  = new LeetCode028();
        String   haystack = "ababa", needle = "ba";
        int i = l028.strStr(haystack, needle);
        System.out.println(i);
    }
}
